package a.f.d.a;

import a.c.e;
import a.c.k;
import a.c.m;
import a.c.v;
import a.c.x;
import a.d.n;
import a.d.s;
import a.f.*;
import a.f.kc;
import a.f.o;
import a.f.tb;
import a.f.yb;
import a.f.zc;

import java.util.ArrayList;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;

import a.f.d.a.z;
import a.f.d.a.y;
import a.d.s;

class sb
{
  private static final Object a = "y.layout.hierarchic.incremental.EdgeLabelingSupport.InstanceDPKey";
  private static final Comparator b = new a_(false);
  private boolean c = false;
  private yb d;
  static final double e = 10.0D;
  static final double f = 10.0D;
  static final int g = 0;
  static final int h = 1;
  static final byte i = 0;
  static final byte j = 1;
  static final byte k = 0;
  static final byte l = 1;
  static final byte m = 2;
  private static final double n = 0.001D;
  
  public sb(yb paramyb)
  {
    this.d = paramyb;
    this.c = true;
  }
  
  static void a(sb paramsb, a.c.q paramq)
  {
    paramq.a(a, a.i.q.a(paramsb));
  }
  
  static void a(a.c.q paramq)
  {
    boolean bool = d.R;
    if (((bool) || (paramq != null)) && ((bool) || (paramq.c(a) != null))) {
      paramq.j(a);
    }
  }
  
  static sb c(a.c.q paramq)
  {
    k localk = paramq.c(a);
    if (!d.R) {
      if (localk == null) {
        return null;
      }
    }
    return (sb)localk.get(paramq);
  }
  
  public List a(o paramo, ac paramac, bc parambc, rb paramrb)
  {
    boolean bool3 = d.R;
    boolean bool2 = d.Q;
    if (!b(paramo)) {
      return null;
    }
    ArrayList localArrayList = new ArrayList(60);
    k localk = a(paramo);
    int i1 = 0;
    if (i1 < paramac.a()) {}
    Object localObject2;
    Object localObject3;
    ec localec1;
    a.c.d locald;
    Object localObject4;
    kc[] arrayOfkc;
    label236:
    label238:
    label370:
    while (bool3)
    {
      localObject1 = paramac.a(i1);
      int i2;
      do
      {
        if (bool2) {
          break label384;
        }
        i2 = !this.c ? 1 : 0;
        localObject2 = ((vb)localObject1).c().f();
        do
        {
          if (localObject2 == null) {
            break;
          }
          if (bool2) {
            break label310;
          }
          if (i2 != 0) {
            break;
          }
          localObject3 = (e)((v)localObject2).c();
          localec1 = parambc.a((e)localObject3);
          if (!bool3)
          {
            if (localec1.d() != 1)
            {
              locald = ((e)localObject3).h();
              do
              {
                if (locald == null) {
                  break;
                }
                if (bool2) {
                  break label310;
                }
                if (i2 != 0) {
                  break;
                }
                localObject4 = parambc.a(locald.f());
                if (!bool3) {
                  if (((ec)localObject4).d() == 1)
                  {
                    if (bool3) {
                      break label236;
                    }
                    arrayOfkc = (kc[])localk.get(((ec)localObject4).g());
                    if (!bool2) {
                      break label238;
                    }
                  }
                }
                arrayOfkc = (kc[])localk.get(locald);
                if ((bool3) || (arrayOfkc != null))
                {
                  if (bool3) {
                    continue;
                  }
                  if (arrayOfkc.length > 0)
                  {
                    i2 = 1;
                    if (bool3) {
                      break label298;
                    }
                    if (!bool2) {
                      break;
                    }
                  }
                }
                locald = locald.i();
              } while (!bool2);
            }
            localObject2 = ((v)localObject2).a();
            if (bool3) {
              break label310;
            }
          }
        } while (!bool2);
      } while (bool3);
      if (this.c)
      {
        if ((!bool3) && (i2 == 0)) {}
      }
      else
      {
        if (bool3) {
          break label370;
        }
        if (i1 < paramac.a() - 1)
        {
          i1++;
          localArrayList.add(paramrb.b(true, i1));
        }
      }
      i1++;
      if (!bool2) {
        break;
      }
    }
    label298:
    label310:
    e[] arrayOfe = new e[paramac.a()];
    label384:
    Object localObject1 = paramo.B();
    paramo.a(getClass().getName() + ".map", (k)localObject1);
    m localm = paramo.w();
    label682:
    label718:
    do
    {
      do
      {
        if (!localm.e()) {
          break label941;
        }
        localObject2 = localm.a();
        localObject3 = parambc.a(((a.c.d)localObject2).e());
        localec1 = parambc.a(((a.c.d)localObject2).f());
        if ((!bool3) && (bool2)) {
          break label954;
        }
        if (bool3) {
          break;
        }
        if (((ec)localObject3).d() != 1)
        {
          if (bool3) {
            break;
          }
          if (localec1.d() == 1)
          {
            locald = localec1.g();
            localObject4 = parambc.a(locald);
            arrayOfkc = a(paramo, locald);
            if (bool3) {
              continue;
            }
            if (arrayOfkc != null)
            {
              if (bool3) {
                break;
              }
              if (arrayOfkc.length > 0)
              {
                int i3 = 0;
                Object localObject5 = localObject2;
                ec localec2 = parambc.a(((a.c.d)localObject5).f());
                e locale;
                do
                {
                  do
                  {
                    if (localec2.d() != 1) {
                      break label682;
                    }
                    locale = ((a.c.d)localObject5).f();
                    int i4 = paramac.a(localec2.h()).d();
                    if (bool2) {
                      break;
                    }
                    if (i4 != 0)
                    {
                      if (bool3) {
                        continue;
                      }
                      if (i4 != 1) {}
                    }
                    else
                    {
                      arrayOfe[(i3++)] = locale;
                    }
                    localObject5 = locale.h();
                    localec2 = parambc.a(((a.c.d)localObject5).f());
                  } while (!bool2);
                  locale = null;
                  if (bool3) {
                    break label718;
                  }
                } while (bool3);
                if (i3 < 1) {
                  throw new IllegalStateException("Did not find edge label position");
                }
                boolean bool1 = ((y)localObject4).k();
                int i5 = 0;
                do
                {
                  if (i5 >= arrayOfkc.length) {
                    break label924;
                  }
                  fd localfd = arrayOfkc[i5].g();
                  if (bool2) {
                    break;
                  }
                  if (localfd.j())
                  {
                    if (!bool3) {}
                    locale = arrayOfe[0];
                    if (bool3) {
                      continue;
                    }
                    if (!bool2) {}
                  }
                  else
                  {
                    if (!bool3) {
                      if (localfd.k())
                      {
                        locale = arrayOfe[(i3 / 2)];
                        if (bool3) {
                          continue;
                        }
                        if (!bool2) {
                          break label903;
                        }
                      }
                    }
                    if (!bool3) {
                      if (localfd.l())
                      {
                        if (!bool3) {}
                        locale = arrayOfe[(i3 - 1)];
                        if (bool3) {
                          continue;
                        }
                        if (!bool2) {
                          break label903;
                        }
                      }
                    }
                    if (!bool3)
                    {
                      if (a(localfd) == 0) {
                        locale = arrayOfe[(i3 / 2)];
                      }
                    }
                    else
                    {
                      if (bool3) {
                        continue;
                      }
                      if (!bool2) {
                        break label903;
                      }
                    }
                    locale = arrayOfe[0];
                  }
                  a(locale, arrayOfkc[i5], (x)localObject1);
                  i5++;
                } while (!bool2);
              }
            }
          }
        }
        localm.f();
      } while (bool3);
    } while (!bool2);
    label903:
    label924:
    label941:
    if (!bool3) {
      a(paramo, parambc, (x)localObject1);
    }
    label954:
    return localArrayList;
  }
  
  protected k a(o paramo)
  {
    return paramo.c(a.f.oc.a);
  }
  
  private boolean a(e parame, ec paramec)
  {
    boolean bool = d.R;
    if ((bool) || (parame.c() > 0)) {
      if (!bool)
      {
        if (paramec.d() == 1) {
          break label48;
        }
        if (bool) {
          break label45;
        }
      }
    }
    label45:
    label48:
    return paramec.d() != 11;
  }
  
  private void a(e parame, kc paramkc, x paramx)
  {
    Object localObject = (List)paramx.get(parame);
    if (!d.R) {
      if (localObject == null)
      {
        localObject = new ArrayList(6);
        paramx.a(parame, localObject);
      }
    }
    ((List)localObject).add(paramkc);
  }
  
  double a(List paramList)
  {
    boolean bool2 = d.R;
    boolean bool1 = d.Q;
    double d1 = 0.0D;
    int i1 = 0;
    do
    {
      while (!bool1)
      {
        if (i1 >= paramList.size()) {
          break;
        }
        if (bool1) {
          break label64;
        }
        d1 = Math.max(((kc)paramList.get(i1)).b(), d1);
        i1++;
      }
    } while (bool2);
    label64:
    return d1;
  }
  
  private void a(o paramo, bc parambc, x paramx)
  {
    boolean bool3 = d.R;
    boolean bool2 = d.Q;
    ArrayList localArrayList1 = new ArrayList(10);
    ArrayList localArrayList2 = new ArrayList(10);
    ArrayList localArrayList3 = new ArrayList(10);
    a.c.w localw = paramo.v();
    label328:
    label350:
    label871:
    label884:
    do
    {
      do
      {
        kc[] arrayOfkc;
        boolean bool1;
        double d4;
        do
        {
          if (!localw.e()) {
            return;
          }
          e locale = localw.d();
          List localList = (List)paramx.get(locale);
          if ((!bool3) && (localList == null)) {
            break;
          }
          arrayOfkc = (kc[])localList.toArray(new kc[localList.size()]);
          a.c.d locald = parambc.a(locale).g();
          if (locald == null) {
            throw new IllegalStateException("realEdge == null: Cannot be!!!");
          }
          y localy = parambc.a(locald);
          bool1 = localy.k();
          double d1 = 0.0D;
          double d2 = 0.0D;
          double d3 = 0.0D;
          int i1 = 0;
          do
          {
            if (i1 >= arrayOfkc.length) {
              break;
            }
            kc localkc1 = arrayOfkc[i1];
            if (bool2) {
              break label350;
            }
            tb localtb = bool1 ? tb.a : tb.c;
            this.d.a(paramo, localkc1, localtb);
            fd localfd1 = localkc1.g();
            if (!bool3) {
              if (localfd1.o())
              {
                d3 = Math.max(d3, localkc1.b());
                if (bool3) {
                  continue;
                }
                if (!bool2) {
                  break label328;
                }
              }
            }
            if (!bool3)
            {
              if ((localfd1.n() ^ bool1)) {
                d1 = Math.max(d1, localkc1.b() + a(localkc1));
              }
            }
            else
            {
              if (bool3) {
                continue;
              }
              if (!bool2) {
                break label328;
              }
            }
            d2 = Math.max(d2, localkc1.b() + a(localkc1));
            i1++;
          } while (!bool2);
          if (!bool3) {
            if (d3 > d1 * 2.0D) {
              d1 = d3 / 2.0D;
            }
          }
          if (!bool3) {
            if (d3 > d2 * 2.0D) {
              d2 = d3 / 2.0D;
            }
          }
          byte[] arrayOfByte = { 1, 4, 0, 2 };
          d4 = 0.0D;
          int i2 = 0;
          do
          {
            if (i2 >= arrayOfByte.length) {
              break label884;
            }
            localArrayList1.clear();
            localArrayList2.clear();
            localArrayList3.clear();
            if (bool2) {
              break;
            }
            int i3 = 0;
            do
            {
              if (i3 >= arrayOfkc.length) {
                break label581;
              }
              kc localkc2 = arrayOfkc[i3];
              fd localfd2 = localkc2.g();
              int i5 = a(localfd2);
              if (bool2) {
                break;
              }
              if (i5 == arrayOfByte[i2])
              {
                if (!bool3) {
                  if (localfd2.o())
                  {
                    localArrayList3.add(localkc2);
                    if (bool3) {
                      continue;
                    }
                    if (!bool2) {
                      break label573;
                    }
                  }
                }
                if (!bool3) {
                  if ((localfd2.n() ^ bool1))
                  {
                    localArrayList1.add(localkc2);
                    if (bool3) {
                      continue;
                    }
                    if (!bool2) {
                      break label573;
                    }
                  }
                }
                localArrayList2.add(localkc2);
              }
              i3++;
            } while (!bool2);
            double d5 = d4;
            double d6 = d4;
            if (bool3) {
              break label1063;
            }
            int i6 = 0;
            kc localkc4;
            do
            {
              if (i6 >= localArrayList1.size()) {
                break;
              }
              if (bool2) {
                break label683;
              }
              if (d5 > 0.0D) {
                d5 += 10.0D;
              }
              localkc4 = (kc)localArrayList1.get(i6);
              localkc4.b(d2 + a(localkc4), d5);
              d5 += localkc4.c();
              i6++;
            } while (!bool2);
            if (!bool3) {
              i6 = 0;
            }
            do
            {
              if (i6 >= localArrayList2.size()) {
                break;
              }
              if (bool2) {
                break label786;
              }
              if (d6 > 0.0D) {
                d6 += 10.0D;
              }
              localkc4 = (kc)localArrayList2.get(i6);
              localkc4.b(d2 - localkc4.b() - a(localkc4), d6);
              d6 += localkc4.c();
              i6++;
            } while (!bool2);
            d4 = Math.max(d5, d6);
            if (!bool3) {
              i6 = 0;
            }
            do
            {
              do
              {
                if (i6 >= localArrayList3.size()) {
                  break label871;
                }
                if (bool2) {
                  break;
                }
                if (d4 > 0.0D) {
                  d4 += 10.0D;
                }
                localkc4 = (kc)localArrayList3.get(i6);
                localkc4.b(d2 - localkc4.b() * 0.5D, d4);
                d4 += localkc4.c();
                i6++;
              } while (!bool2);
              i2++;
            } while (bool3);
          } while (!bool2);
          paramo.b(locale, d1 + d2, d4);
          a.d.w localw1 = new a.d.w(d2 - (d1 + d2) * 0.5D, -d4 * 0.5D);
          paramo.b(locale.i(), localw1);
          a.d.w localw2 = new a.d.w(d2 - (d1 + d2) * 0.5D, d4 * 0.5D);
          paramo.a(locale.h(), localw2);
        } while (bool3);
        if ((bool3) || (bool1))
        {
          int i4 = 0;
          do
          {
            if (i4 >= arrayOfkc.length) {
              break;
            }
            kc localkc3 = arrayOfkc[i4];
            localkc3.b(localkc3.d(), d4 - localkc3.c() - localkc3.e());
            i4++;
            if (bool3) {
              break label1063;
            }
            if (bool2) {
              break label1061;
            }
          } while (!bool2);
        }
      } while (bool3);
      localw.f();
    } while (!bool2);
    label573:
    label581:
    return;
  }
  
  public kc[] a(o paramo, a.c.d paramd)
  {
    k localk = a(paramo);
    if (!d.R) {
      if (localk == null) {
        return null;
      }
    }
    return (kc[])localk.get(paramd);
  }
  
  private kc[] a(e parame, x paramx)
  {
    List localList = (List)paramx.get(parame);
    if ((d.R) || (localList != null))
    {
      kc[] arrayOfkc = (kc[])localList.toArray(new kc[localList.size()]);
      return arrayOfkc;
    }
    return null;
  }
  
  private boolean b(o paramo)
  {
    k localk = a(paramo);
    return localk != null;
  }
  
  public void a(o paramo, ac paramac, bc parambc, rb paramrb, List paramList)
  {
    boolean bool2 = d.R;
    boolean bool1 = d.Q;
    if (!b(paramo)) {
      return;
    }
    String str = getClass().getName() + ".map";
    x localx = (x)paramo.c(str);
    paramo.j(str);
    a.c.w localw = paramo.v();
    Object localObject;
    label315:
    label317:
    do
    {
      do
      {
        if (!localw.e()) {
          break;
        }
        localObject = localw.d();
        kc[] arrayOfkc = a((e)localObject, localx);
        if (((bool2) || (arrayOfkc != null)) && (arrayOfkc.length > 0))
        {
          a.c.d locald = parambc.a((e)localObject).g();
          if (locald == null) {
            throw new IllegalStateException("realEdge == null: Cannot be!!!");
          }
          zc localzc = paramo.k((e)localObject);
          double d1 = localzc.a();
          double d3;
          double d4;
          do
          {
            double d2 = localzc.b();
            int i2 = 0;
            do
            {
              if (i2 >= arrayOfkc.length) {
                break;
              }
              kc localkc = arrayOfkc[i2];
              localkc.b(localkc.d() + d1, localkc.e() + d2);
              this.d.a(paramo, localkc);
              i2++;
              if (bool2) {
                break label317;
              }
              if (bool1) {
                break label315;
              }
            } while (!bool1);
            d3 = paramo.s(((e)localObject).i()).a;
            d4 = paramo.n((e)localObject);
            localzc.b(0.0D, 0.0D);
            paramo.a(((e)localObject).h(), a.d.w.c);
            paramo.b(((e)localObject).i(), a.d.w.c);
          } while (bool2);
          localzc.a(d3, d4);
        }
        localw.f();
      } while (!bool1);
    } while (bool2);
    int i1 = 0;
    if (i1 < paramList.size()) {}
    while (bool2)
    {
      localObject = (vb)paramList.get(i1);
      ((vb)localObject).b();
      i1++;
      if ((!bool2) && (bool1)) {
        return;
      }
      if (!bool1) {
        break;
      }
    }
    paramo.a(localx);
  }
  
  boolean a(a.c.d paramd, a.d.y paramy)
  {
    boolean bool = d.R;
    n localn = paramy.a(0);
    if (!bool) {
      if (paramd.g())
      {
        if (bool) {
          break label49;
        }
        if (localn.c()) {
          if (bool) {
            break label49;
          }
        }
      }
    }
    label49:
    return paramy.k() != 3;
  }
  
  public void a(o paramo, ac paramac, bc parambc)
  {
    boolean bool3 = d.R;
    boolean bool2 = d.Q;
    m localm = paramo.w();
    label177:
    label225:
    label232:
    do
    {
      do
      {
        if (!localm.e()) {
          return;
        }
        a.c.d locald = localm.a();
        if (locald.g())
        {
          kc[] arrayOfkc = a(paramo, locald);
          if (((bool3) || (arrayOfkc != null)) && (arrayOfkc.length > 0))
          {
            a.d.y localy = paramo.n(locald);
            int i1 = localy.k();
            boolean bool1 = a(locald, localy);
            int i2;
            Object localObject;
            if ((bool3) || (i1 >= 3))
            {
              i2 = 1;
              do
              {
                do
                {
                  if (i2 >= i1 - 1) {
                    break;
                  }
                  localObject = localy.a(i2);
                  if (bool2) {
                    break label232;
                  }
                  if (((n)localObject).c())
                  {
                    if (bool3) {
                      break label177;
                    }
                    if (bool1)
                    {
                      a((n)localObject, arrayOfkc, true, true, paramo);
                      if (bool3) {
                        break label225;
                      }
                      if (!bool2) {
                        break;
                      }
                    }
                  }
                  if (!bool3)
                  {
                    if (((n)localObject).b())
                    {
                      if (bool3) {
                        continue;
                      }
                      if (!bool1)
                      {
                        a((n)localObject, arrayOfkc, true, paramo);
                        if (bool3) {
                          break label225;
                        }
                        if (!bool2) {
                          break;
                        }
                      }
                    }
                    i2++;
                  }
                } while (!bool2);
              } while (bool3);
              i2 = i1 - 2;
              do
              {
                if (i2 <= 0) {
                  break;
                }
                localObject = localy.a(i2);
                if (bool2) {
                  break label349;
                }
                if (((n)localObject).c())
                {
                  if (bool3) {
                    break label297;
                  }
                  if (bool1)
                  {
                    a((n)localObject, arrayOfkc, false, false, paramo);
                    if ((!bool3) && (!bool2)) {
                      break;
                    }
                  }
                }
                if (!bool3)
                {
                  if (((n)localObject).b())
                  {
                    if (bool3) {
                      continue;
                    }
                    if (!bool1)
                    {
                      a((n)localObject, arrayOfkc, false, paramo);
                      if (bool3) {
                        continue;
                      }
                      if (!bool2) {
                        break;
                      }
                    }
                  }
                  i2--;
                }
              } while (!bool2);
            }
            if (!bool3)
            {
              i2 = 0;
              do
              {
                if (i2 >= arrayOfkc.length) {
                  break;
                }
                localObject = arrayOfkc[i2];
                this.d.a(paramo, (kc)localObject);
                i2++;
                if (bool3) {
                  break label408;
                }
                if (bool2) {
                  break label406;
                }
              } while (!bool2);
            }
          }
        }
      } while (bool3);
      localm.f();
    } while (!bool2);
    label297:
    label349:
    return;
  }
  
  private boolean a(a.d.y paramy, boolean paramBoolean)
  {
    boolean bool = d.R;
    int i1 = paramy.j() - 1;
    if ((bool) || (i1 != 3))
    {
      if (bool) {
        break label90;
      }
      if (paramBoolean)
      {
        if (bool) {
          break label90;
        }
        if (i1 != 5) {}
      }
    }
    else
    {
      n localn1 = paramy.a(0);
      n localn2 = paramy.a(i1 - 1);
      if ((bool) || (localn1.c())) {
        if (bool) {}
      }
      return localn2.c();
    }
    label90:
    return false;
  }
  
  private boolean a(a.d.y paramy)
  {
    boolean bool2 = d.R;
    boolean bool1 = d.Q;
    if (!bool2) {
      if (paramy.k() <= 1) {
        return true;
      }
    }
    int i1 = 0;
    int i2 = 0;
    int i3 = 0;
    label91:
    do
    {
      if (i3 >= paramy.k()) {
        break;
      }
      n localn = paramy.a(i3);
      if (bool1) {
        break label105;
      }
      if (localn.h() > 0.0D)
      {
        if (!bool2) {
          if (localn.c())
          {
            i2 = 1;
            if (bool2) {
              continue;
            }
            if (!bool1) {
              break label91;
            }
          }
        }
        i1 = 1;
      }
      i3++;
    } while (!bool1);
    if ((!bool2) && (i1 != 0)) {
      label105:
      if (bool2) {
        break label118;
      }
    }
    label118:
    return i2 == 0;
  }
  
  public void c(o paramo, ac paramac, bc parambc)
  {
    boolean bool4 = d.R;
    boolean bool3 = d.Q;
    int i1 = 0;
    label255:
    do
    {
      if (i1 >= paramac.a()) {
        break;
      }
      vb localvb = paramac.a(i1);
      v localv = localvb.a().f();
      do
      {
        do
        {
          if (localv == null) {
            break label429;
          }
          a.c.d locald = (a.c.d)localv.c();
          kc[] arrayOfkc = a(paramo, locald);
          if (bool4) {
            break label439;
          }
          if (bool3) {
            break label437;
          }
          if (((bool4) || (arrayOfkc != null)) && (arrayOfkc.length > 0))
          {
            a.d.y localy = paramo.n(locald);
            z localz = parambc.a(locald).m();
            int i2 = localz.i().d();
            if (!bool4) {}
            boolean bool1 = i2 != 0;
            boolean bool2 = a(localy, bool1);
            if (!bool4) {
              if (bool2)
              {
                a(localy.a(0), arrayOfkc, true, false, paramo);
                if ((!bool4) && (!bool3)) {
                  break label255;
                }
              }
            }
            int i3 = 1;
            Object localObject;
            do
            {
              if (i3 >= localy.k()) {
                break;
              }
              localObject = localy.a(i3);
              if (bool3) {
                break label262;
              }
              if (((n)localObject).c())
              {
                a((n)localObject, arrayOfkc, true, true, paramo);
                if (!bool4) {
                  if (!bool3) {
                    break;
                  }
                }
              }
              else
              {
                i3++;
              }
            } while (!bool3);
            if ((!bool4) && (bool2))
            {
              a(localy.a(localy.k() - 1), arrayOfkc, false, true, paramo);
              if ((!bool4) && (!bool3)) {}
            }
            else
            {
              i3 = localy.k() - 2;
              do
              {
                if (i3 < 0) {
                  break;
                }
                localObject = localy.a(i3);
                if (bool3) {
                  break label367;
                }
                if (((n)localObject).c())
                {
                  a((n)localObject, arrayOfkc, false, false, paramo);
                  if (!bool4) {
                    if (!bool3) {
                      break;
                    }
                  }
                }
                else
                {
                  i3--;
                }
              } while (!bool3);
            }
            if (!bool4)
            {
              i3 = 0;
              do
              {
                if (i3 >= arrayOfkc.length) {
                  break;
                }
                localObject = arrayOfkc[i3];
                this.d.a(paramo, (kc)localObject);
                i3++;
                if (bool4) {
                  break label426;
                }
                if (bool3) {
                  break label424;
                }
              } while (!bool3);
            }
          }
        } while (bool4);
        localv = localv.a();
      } while (!bool3);
      if (!bool4) {
        i1++;
      }
    } while (!bool3);
    label262:
    label367:
    return;
  }
  
  private void a(n paramn, kc[] paramArrayOfkc, boolean paramBoolean, o paramo)
  {
    boolean bool2 = d.R;
    boolean bool1 = d.Q;
    a.d.w localw1 = paramn.d();
    a.d.w localw2 = paramn.e();
    kc[] arrayOfkc = new kc[paramArrayOfkc.length];
    int i1 = 0;
    if (i1 < paramArrayOfkc.length)
    {
      arrayOfkc[i1] = paramArrayOfkc[i1];
      i1++;
    }
    for (;;)
    {
      if (!bool2) {
        if (!bool1)
        {
          if (!bool1) {
            break;
          }
          if (bool2) {
            continue;
          }
          a(arrayOfkc);
        }
      }
    }
    tb localtb = paramn.l() > 0.0D ? tb.c : tb.a;
    if (!bool2) {
      if (localtb == tb.c)
      {
        if (bool2) {
          break label137;
        }
        if (paramBoolean) {
          break label136;
        }
      }
    }
    if (localtb == tb.a) {
      if (bool2) {}
    }
    label136:
    label137:
    int i2 = !paramBoolean ? 1 : 0;
    double d1 = localw1.a();
    double d2 = i2 != 0 ? Math.min(localw1.b(), localw2.b()) + 10.0D : Math.max(localw1.b(), localw2.b()) - 10.0D;
    double d3 = d2;
    double d4 = d2;
    double d5 = -1.0D;
    if (!bool2) {}
    int i3 = paramBoolean ? 0 : arrayOfkc.length - 1;
    if (paramBoolean ? (bool2) || ((bool1) || (i3 < arrayOfkc.length)) : i3 >= 0) {}
    label566:
    label568:
    label638:
    while (bool2)
    {
      kc localkc = arrayOfkc[i3];
      fd localfd = localkc.g();
      if (!bool2) {
        if (localfd.a() != d5)
        {
          d3 = d4 = i2 != 0 ? Math.max(d3, d4) : Math.min(d3, d4);
          d5 = localfd.a();
        }
      }
      if (!bool2) {
        if (paramBoolean)
        {
          if (bool2) {
            break label640;
          }
          if (localfd.l()) {
            break label638;
          }
        }
      }
      if ((bool2) || ((paramBoolean) || (localfd.l())))
      {
        double d6 = localkc.b();
        double d7 = localkc.c();
        if (!bool2) {
          if (!localfd.n())
          {
            if (bool2) {
              break label568;
            }
            if (!localfd.p()) {
              break label566;
            }
          }
        }
        if (!bool2) {
          if (a(localfd, localtb))
          {
            d8 = i2 != 0 ? d3 : d3 - d7;
            localkc.b(d1 - d6 - a(localkc), d8);
            if (!bool2) {}
            d3 += (d7 + 10.0D) * (i2 != 0 ? 1 : -1);
            if (bool2) {
              break label640;
            }
            if (!bool1) {
              break label638;
            }
          }
        }
        double d8 = i2 != 0 ? d4 : d4 - d7;
        localkc.b(d1 + a(localkc), d8);
        if (!bool2) {}
        d4 += (d7 + 10.0D) * (i2 != 0 ? 1 : -1);
        if (bool2) {
          break label640;
        }
        if (bool1)
        {
          d8 = i2 != 0 ? Math.max(d3, d4) : Math.min(d3, d4) - d7;
          localkc.b(d1 - d6 * 0.5D, d8);
          d8 += (i2 != 0 ? d7 + 10.0D : -10.0D);
          d3 = d4 = d8;
        }
      }
      if (!bool2) {}
      i3 += (paramBoolean ? 1 : -1);
      if (!bool1) {
        break;
      }
    }
    label640:
  }
  
  private void a(kc[] paramArrayOfkc)
  {
    l.a(paramArrayOfkc, b);
  }
  
  private void b(List paramList)
  {
    l.a(paramList, b);
  }
  
  private void a(n paramn, kc[] paramArrayOfkc, boolean paramBoolean1, boolean paramBoolean2, o paramo)
  {
    boolean bool2 = d.R;
    boolean bool1 = d.Q;
    a.d.w localw1 = paramn.d();
    a.d.w localw2 = paramn.e();
    kc[] arrayOfkc = new kc[paramArrayOfkc.length];
    int i1 = 0;
    if (i1 < paramArrayOfkc.length)
    {
      arrayOfkc[i1] = paramArrayOfkc[i1];
      i1++;
    }
    for (;;)
    {
      if (!bool2) {
        if (!bool1)
        {
          if (!bool1) {
            break;
          }
          if (bool2) {
            continue;
          }
          a(arrayOfkc);
        }
      }
    }
    tb localtb = paramn.k() > 0.0D ? tb.b : tb.d;
    if (!bool2) {
      if (localtb == tb.b)
      {
        if (bool2) {
          break label139;
        }
        if (paramBoolean2) {
          break label138;
        }
      }
    }
    if (localtb == tb.d) {
      if (bool2) {}
    }
    label138:
    label139:
    int i2 = !paramBoolean2 ? 1 : 0;
    double d1 = localw1.b();
    double d2 = i2 != 0 ? Math.min(localw1.a(), localw2.a()) + 10.0D : Math.max(localw1.a(), localw2.a()) - 10.0D;
    double d3 = d2;
    double d4 = d2;
    if (!bool2) {
      if (paramBoolean1)
      {
        if (bool2) {
          break label243;
        }
        if (paramBoolean2) {
          break label242;
        }
      }
    }
    if ((bool2) || (!paramBoolean1)) {
      if (bool2) {}
    }
    label242:
    label243:
    int i3 = !paramBoolean2 ? 1 : 0;
    double d5 = -1.0D;
    if (!bool2) {}
    int i4 = i3 != 0 ? 0 : arrayOfkc.length - 1;
    if (i3 != 0 ? (bool2) || ((bool1) || (i4 < arrayOfkc.length)) : i4 >= 0) {}
    label615:
    label617:
    while (bool2)
    {
      kc localkc = arrayOfkc[i4];
      fd localfd = localkc.g();
      if (!bool2) {
        if (localfd.a() != d5)
        {
          d3 = d4 = i2 != 0 ? Math.max(d3, d4) : Math.min(d3, d4);
          d5 = localfd.a();
        }
      }
      if (!bool2) {
        if (paramBoolean1)
        {
          if (bool2) {
            break label689;
          }
          if (localfd.l()) {
            break label687;
          }
        }
      }
      if ((bool2) || ((paramBoolean1) || (localfd.l())))
      {
        double d6 = localkc.b();
        double d7 = localkc.c();
        if (!bool2) {
          if (!localfd.n())
          {
            if (bool2) {
              break label617;
            }
            if (!localfd.p()) {
              break label615;
            }
          }
        }
        if (!bool2) {
          if (a(localfd, localtb))
          {
            d8 = i2 != 0 ? d3 : d3 - d6;
            localkc.b(d8, d1 - d7 - a(localkc));
            if (!bool2) {}
            d3 += (d6 + 10.0D) * (i2 != 0 ? 1 : -1);
            if (bool2) {
              break label689;
            }
            if (!bool1) {
              break label687;
            }
          }
        }
        double d8 = i2 != 0 ? d4 : d4 - d6;
        localkc.b(d8, d1 + a(localkc));
        if (!bool2) {}
        d4 += (d6 + 10.0D) * (i2 != 0 ? 1 : -1);
        if (bool2) {
          break label689;
        }
        if (bool1)
        {
          d8 = i2 != 0 ? Math.max(d3, d4) : Math.min(d3, d4) - d6;
          localkc.b(d8, d1 - d7 * 0.5D);
          d8 += (i2 != 0 ? d6 + 10.0D : -10.0D);
          d3 = d4 = d8;
        }
      }
      if (!bool2) {}
      i4 += (i3 != 0 ? 1 : -1);
      if (!bool1) {
        break;
      }
    }
    label687:
    label689:
    return;
  }
  
  private boolean a(fd paramfd, tb paramtb)
  {
    boolean bool = d.R;
    return ((!bool) && ((paramfd.n()) && ((!bool) && ((paramtb == tb.a) || (paramtb == tb.b))))) || ((paramfd.p()) && ((bool) || ((paramtb == tb.c) || (paramtb == tb.d))));
  }
  
  public boolean a()
  {
    return this.c;
  }
  
  public void a(boolean paramBoolean)
  {
    this.c = paramBoolean;
  }
  
  private boolean a(n paramn)
  {
    boolean bool = d.R;
    if (!bool) {
      if (paramn.c())
      {
        if (!bool) {}
        return paramn.k() > 0.0D;
      }
    }
    if (!bool) {}
    return paramn.l() > 0.0D;
  }
  
  public s a(o paramo, a.c.d paramd, byte paramByte, double[] paramArrayOfDouble, n paramn)
  {
    boolean bool1 = paramn.c();
    boolean bool2 = a(paramn);
    return a(paramo, paramd, paramByte, paramArrayOfDouble, bool1, bool2);
  }
  
  public s a(o paramo, a.c.d paramd, byte paramByte, double[] paramArrayOfDouble, boolean paramBoolean1, boolean paramBoolean2)
  {
    return a(paramo, paramd, paramByte, paramArrayOfDouble, paramBoolean1, paramBoolean2, (byte)0);
  }
  
  public s a(o paramo, a.c.d paramd, byte paramByte1, double[] paramArrayOfDouble, boolean paramBoolean1, boolean paramBoolean2, byte paramByte2)
  {
    boolean bool3 = d.R;
    boolean bool2 = d.Q;
    if (!bool3) {}
    tb localtb = paramBoolean2 ? tb.c : paramBoolean1 ? tb.d : paramBoolean2 ? tb.b : tb.a;
    double[] arrayOfDouble1 = { 0.0D, 0.0D };
    double[] arrayOfDouble2 = { 0.0D, 0.0D };
    kc[] arrayOfkc = a(paramo, paramd);
    label268:
    label270:
    label559:
    label1215:
    if (((bool3) || (arrayOfkc != null)) && (arrayOfkc.length > 0))
    {
      ArrayList localArrayList = new ArrayList();
      int i1 = 0;
      Object localObject2;
      label226:
      label235:
      label248:
      do
      {
        if (i1 >= arrayOfkc.length) {
          break;
        }
        localObject1 = arrayOfkc[i1];
        localObject2 = ((kc)localObject1).g();
        if (bool3) {
          break label270;
        }
        if (bool2) {
          break label268;
        }
        if (paramByte2 != 0)
        {
          if (!bool3) {
            if (paramByte2 == 2)
            {
              if (bool3) {
                break label235;
              }
              if (((fd)localObject2).j()) {
                break label226;
              }
            }
          }
          if (bool3) {
            break label235;
          }
          if (!((fd)localObject2).k())
          {
            if (bool3) {
              continue;
            }
            if (paramByte2 != 1) {
              break label248;
            }
            if (bool3) {
              continue;
            }
            if (((fd)localObject2).j()) {
              break label248;
            }
            if (bool3) {
              continue;
            }
            if (((fd)localObject2).k()) {
              break label248;
            }
          }
        }
        localArrayList.add(localObject1);
        this.d.a(paramo, (kc)localObject1, localtb);
        i1++;
      } while (!bool2);
      b(localArrayList);
      if (!bool3) {
        i1 = -1;
      }
      Object localObject1 = localArrayList.iterator();
      label619:
      label1144:
      do
      {
        do
        {
          do
          {
            do
            {
              do
              {
                do
                {
                  int i3;
                  int i4;
                  do
                  {
                    if (!((Iterator)localObject1).hasNext()) {
                      break label1215;
                    }
                    localObject2 = (kc)((Iterator)localObject1).next();
                    fd localfd = ((kc)localObject2).g();
                    if ((!bool3) && (bool2)) {
                      break label1334;
                    }
                    if (localfd.a() != i1)
                    {
                      if (!bool3)
                      {
                        if (paramBoolean1)
                        {
                          tmp355_352 = Math.max(arrayOfDouble1[0], arrayOfDouble1[1]);
                          arrayOfDouble1[1] = tmp355_352;
                          arrayOfDouble1[0] = tmp355_352;
                        }
                      }
                      else
                      {
                        if (bool3) {
                          break label393;
                        }
                        if (!bool2) {
                          break label388;
                        }
                      }
                      tmp385_382 = Math.max(arrayOfDouble2[0], arrayOfDouble2[1]);
                      arrayOfDouble2[1] = tmp385_382;
                      arrayOfDouble2[0] = tmp385_382;
                      i1 = localfd.a();
                    }
                    if ((bool3) || (!localfd.n())) {
                      if (bool3) {}
                    }
                    int i2 = !localfd.p() ? 1 : 0;
                    if (bool3) {
                      break label734;
                    }
                    if (i2 != 0) {
                      break label733;
                    }
                    boolean bool1 = a(localfd, localtb);
                    if (!bool3) {}
                    i3 = bool1 ? 0 : 1;
                    if (!bool3) {}
                    i4 = bool1 ? 0 : 1;
                    if (bool3) {
                      break label619;
                    }
                    if (paramByte1 != 0) {
                      break;
                    }
                    if (!bool3) {
                      if (arrayOfDouble1[i3] > 0.0D)
                      {
                        arrayOfDouble1[i3] += 10.0D;
                        if (bool3) {
                          break label559;
                        }
                      }
                    }
                    if ((bool2) && (!paramBoolean1)) {
                      arrayOfDouble1[i3] += a((kc)localObject2);
                    }
                    arrayOfDouble1[i3] += ((kc)localObject2).b();
                    d4 = ((kc)localObject2).c();
                    if (!bool3)
                    {
                      if (paramBoolean1) {
                        d4 += a((kc)localObject2);
                      }
                      arrayOfDouble2[i4] = Math.max(arrayOfDouble2[i4], d4);
                    }
                  } while ((!bool3) && (!bool2));
                  if (!bool3) {
                    if (arrayOfDouble2[i4] > 0.0D)
                    {
                      arrayOfDouble2[i4] += 10.0D;
                      if (bool3) {
                        break label680;
                      }
                    }
                  }
                  if ((bool2) && (paramBoolean1)) {
                    arrayOfDouble2[i4] += a((kc)localObject2);
                  }
                  arrayOfDouble2[i4] += ((kc)localObject2).c();
                  double d4 = ((kc)localObject2).b();
                  if (!bool3)
                  {
                    if (!paramBoolean1) {
                      d4 += a((kc)localObject2);
                    }
                    arrayOfDouble1[i3] = Math.max(arrayOfDouble1[i3], d4);
                  }
                } while ((!bool3) && (!bool2));
                if (bool3) {
                  break label983;
                }
                if (paramByte1 != 0) {
                  break label981;
                }
                if ((!bool3) && (!paramBoolean1)) {
                  break;
                }
                if (!bool3) {
                  if (arrayOfDouble1[0] > 0.0D) {
                    arrayOfDouble1[0] += 10.0D;
                  }
                }
                if (!bool3)
                {
                  if (arrayOfDouble1[1] > 0.0D) {
                    arrayOfDouble1[1] += 10.0D;
                  }
                  arrayOfDouble1[0] += ((kc)localObject2).b();
                  arrayOfDouble1[1] += ((kc)localObject2).b();
                  arrayOfDouble2[0] = Math.max(arrayOfDouble2[0], ((kc)localObject2).c() * 0.5D);
                  arrayOfDouble2[1] = Math.max(arrayOfDouble2[1], ((kc)localObject2).c() * 0.5D);
                }
              } while (bool3);
            } while (!bool2);
            d3 = ((kc)localObject2).b() * 0.5D;
            if (!bool3) {
              if (arrayOfDouble1[0] <= 0.0D)
              {
                if (bool3) {
                  continue;
                }
                if (arrayOfDouble1[1] <= 0.0D) {
                  break label921;
                }
              }
            }
            d3 += 5.0D;
            arrayOfDouble1[0] += d3;
            arrayOfDouble1[1] += d3;
            arrayOfDouble2[0] = Math.max(arrayOfDouble2[0], ((kc)localObject2).c());
            arrayOfDouble2[1] = Math.max(arrayOfDouble2[1], ((kc)localObject2).c());
          } while ((!bool3) && (!bool2));
          if (bool3) {
            break label1144;
          }
          if (!paramBoolean1) {
            break;
          }
          arrayOfDouble1[0] = Math.max(arrayOfDouble1[0], ((kc)localObject2).b());
          arrayOfDouble1[1] = Math.max(arrayOfDouble1[1], ((kc)localObject2).b());
          double d3 = ((kc)localObject2).c() * 0.5D;
          if (!bool3) {
            if (arrayOfDouble2[0] <= 0.0D)
            {
              if (bool3) {
                break label1090;
              }
              if (arrayOfDouble2[1] <= 0.0D) {
                break label1070;
              }
            }
          }
          d3 += 5.0D;
          arrayOfDouble2[0] += d3;
          arrayOfDouble2[1] += d3;
          if (bool3) {
            break label1144;
          }
        } while (!bool2);
        arrayOfDouble1[0] = Math.max(arrayOfDouble1[0], ((kc)localObject2).b() * 0.5D);
        arrayOfDouble1[1] = Math.max(arrayOfDouble1[1], ((kc)localObject2).b() * 0.5D);
        if (!bool3) {
          if (arrayOfDouble2[0] > 0.0D) {
            arrayOfDouble2[0] += 10.0D;
          }
        }
        if (!bool3)
        {
          if (arrayOfDouble2[1] > 0.0D) {
            arrayOfDouble2[1] += 10.0D;
          }
          arrayOfDouble2[0] += ((kc)localObject2).c();
          arrayOfDouble2[1] += ((kc)localObject2).c();
        }
      } while (!bool2);
      label733:
      label734:
      if (!bool3)
      {
        if (!bool3) {}
        arrayOfDouble1[0] += (arrayOfDouble1[0] != 0.0D ? 10.0D : 0.0D);
        if (!bool3) {}
        arrayOfDouble1[1] += (arrayOfDouble1[1] != 0.0D ? 10.0D : 0.0D);
        if (!bool3) {}
        arrayOfDouble2[0] += (arrayOfDouble2[0] != 0.0D ? 10.0D : 0.0D);
        if (!bool3) {}
        arrayOfDouble2[1] += (arrayOfDouble2[1] != 0.0D ? 10.0D : 0.0D);
      }
    }
    else
    {
      label981:
      label983:
      if (paramBoolean1)
      {
        paramArrayOfDouble[0] = arrayOfDouble2[0];
        paramArrayOfDouble[1] = arrayOfDouble2[1];
        d1 = Math.max(arrayOfDouble1[0], arrayOfDouble1[1]);
        if (!bool3) {}
        d1 += (d1 != 0.0D ? 10.0D : 0.0D);
        d2 = arrayOfDouble2[0] + arrayOfDouble2[1];
        if (bool3) {
          break label1451;
        }
        if (!bool2) {
          break label1475;
        }
      }
      label1090:
      paramArrayOfDouble[0] = arrayOfDouble1[0];
    }
    label388:
    label393:
    label680:
    label1070:
    label1334:
    paramArrayOfDouble[1] = arrayOfDouble1[1];
    label921:
    double d1 = arrayOfDouble1[0] + arrayOfDouble1[1];
    double d2 = Math.max(arrayOfDouble2[0], arrayOfDouble2[1]);
    label1451:
    if (!bool3) {}
    d2 += (d2 != 0.0D ? 10.0D : 0.0D);
    label1475:
    return new s(d1, d2);
  }
  
  public s a(o paramo, a.c.d paramd, byte paramByte)
  {
    n localn = new n(new a.d.w(0.0D, 0.0D), new a.d.w(1.0D, 0.0D));
    return a(paramo, paramd, paramByte, new double[2], localn);
  }
  
  public double a(o paramo, bc parambc, e parame1, e parame2)
  {
    boolean bool2 = d.R;
    boolean bool1 = d.Q;
    double d1 = 0.0D;
    if ((bool2) || ((parame1 != null) && (parame2 != null)))
    {
      ec localec1 = parambc.a(parame1);
      if (!bool2) {
        if (localec1.d() == 3)
        {
          if (bool2) {
            break label102;
          }
          if (localec1.i() > parambc.a(localec1.f()).i()) {
            localec1 = parambc.a(localec1.f());
          }
        }
      }
      label102:
      v localv = localec1.b();
      label306:
      label381:
      do
      {
        if (localv == null) {
          break;
        }
        a.c.d locald = (a.c.d)localv.c();
        ec localec2 = parambc.a(parame2);
        if (((bool2) || (localec2.d() == 3)) && ((bool2) || (localec2.g() == locald))) {
          if (bool2) {}
        }
        int i1 = localec2.i() < parambc.a(localec2.f()).i() ? 1 : 0;
        double d2;
        s locals;
        double d3;
        if (locald.f() != parame2)
        {
          if (i1 != 0)
          {
            if (bool2) {
              break label306;
            }
            if (locald.f() != localec2.f()) {}
          }
        }
        else
        {
          d2 = a(parambc, locald);
          locals = a(paramo, locald, (byte)0, new double[2], true, true);
          d3 = locals.b() + 2.0D * d2;
          d1 = Math.max(d1, d3);
          if (bool2) {
            continue;
          }
          if (!bool1) {
            break label381;
          }
        }
        if (locald.e() != parame2)
        {
          if (bool2) {
            continue;
          }
          if ((i1 == 0) || (locald.e() != localec2.f())) {}
        }
        else
        {
          d2 = a(parambc, locald);
          locals = a(paramo, locald, (byte)0, new double[2], true, false);
          d3 = locals.b() + 2.0D * d2;
          d1 = Math.max(d1, d3);
        }
        localv = localv.a();
      } while (!bool1);
    }
    return d1;
  }
  
  private double a(bc parambc, a.c.d paramd)
  {
    z localz = parambc.a(paramd).m();
    int i1 = localz.i().d();
    if (!d.R) {}
    int i2 = i1 == 1 ? 1 : 0;
    return i2 != 0 ? localz.j() / Math.sqrt(2.0D) : 0.0D;
  }
  
  private double a(kc paramkc)
  {
    fd localfd = paramkc.g();
    return (d.R) || ((localfd.n()) || (localfd.p())) ? Math.max(0.0D, localfd.h()) : 0.0D;
  }
  
  private static byte a(fd paramfd)
  {
    byte b1 = paramfd.a();
    if (!d.R) {
      if (b1 == 7) {
        return 0;
      }
    }
    return b1;
  }
  
  static final class a_
    implements Comparator
  {
    boolean a;
    
    a_(boolean paramBoolean)
    {
      this.a = paramBoolean;
    }
    
    public int compare(Object paramObject1, Object paramObject2)
    {
      boolean bool = d.R;
      if (!bool) {
        if (this.a)
        {
          localfd2 = ((kc)paramObject1).g();
          localfd1 = ((kc)paramObject2).g();
          if (bool) {
            break label66;
          }
          if (!d.Q) {
            break label62;
          }
        }
      }
      fd localfd1 = ((kc)paramObject1).g();
      fd localfd2 = ((kc)paramObject2).g();
      label62:
      label66:
      int i = localfd1.b();
      int j = localfd2.b();
      int k = localfd1.a();
      int m = localfd2.a();
      if (!bool) {
        if (k == m)
        {
          if (!bool) {
            if (i == j) {
              return 0;
            }
          }
          if (!bool) {
            if (i == 16) {
              return -1;
            }
          }
          if (!bool) {
            if (j == 16) {
              return 1;
            }
          }
          if (!bool)
          {
            if (i == 32) {
              return -1;
            }
            if (bool) {}
          }
          else if (j == 32)
          {
            return 1;
          }
          return 0;
        }
      }
      if (!bool) {
        if (k == 1) {
          return -1;
        }
      }
      if (!bool) {
        if (k == 2) {
          return 1;
        }
      }
      if (!bool)
      {
        if (m == 1) {
          return 1;
        }
        if (bool) {}
      }
      else if (m == 2)
      {
        return -1;
      }
      return 0;
    }
  }
}



/* Location:           E:\idea\

 * Qualified Name:     a.f.d.a.sb

 * JD-Core Version:    0.7.0.1

 */